/* 
Scenic Graphics Library
Copyright (C) 2007 Jouni Tulkki

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USApackage scenic;
*/

package scenic.toolkit;

import java.awt.geom.Rectangle2D;

import scenic.ScenicColor;
import scenic.ScenicGraphics;

public class LabelView extends ComponentView {
	public LabelView(LabelModel model) {
		super(model);
	}
	
	public LabelModel getModel() {
		return (LabelModel)super.getModel();
	}
	
	public void paint(ScenicGraphics g) {
		g.clear();
		g.setFont(getModel().getFont().getAwtFont());
		Rectangle2D bounds = g.getTextLogicalBounds(getModel().getText().toString());
		g.translate(0, -bounds.getY());
		g.setFillColor(new ScenicColor(0.0f));
		g.drawText(getModel().getText().toString());
	}
}
